package com.example.tnot.Teacher.MinePart.InternalFragment.collection;

import android.os.Bundle;

import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.tnot.R;
import com.example.tnot.Teacher.MinePart.InternalFragment.collection.ItemBean.rv_collection;
import com.example.tnot.Teacher.MinePart.InternalFragment.collection.adapter.rvCollectAdapter;

import java.util.ArrayList;
import java.util.List;

public class CollectInternalFragment extends Fragment {
    private static final String ARG_CONTENT = "content";
    View view;

    RecyclerView rv_Collection;
    private List<rv_collection> data;

    public CollectInternalFragment() {
    }

    public static CollectInternalFragment newInstance(String content) {
        CollectInternalFragment fragment = new CollectInternalFragment();
        Bundle args = new Bundle();
        args.putString(ARG_CONTENT, content);
        fragment.setArguments(args);
        return fragment;
    }
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        view = inflater.inflate(R.layout.mine_collect_internal_fragment, container, false);

        rv_Collection = view.findViewById(R.id.rv_Collection);
        String type = getArguments().getString(ARG_CONTENT);
        if(type !=null){
            switch (type){
                case "试卷类":

                    data = new ArrayList<>();
                    data.add(new rv_collection("2024年四川省遂宁市中考数学试卷", "一、选择题(本大题共10个小题，每小题4分，共40分,在每个小题给出的四个选项..",
                            R.drawable.example_face, "我是标签一", "我是标签二", "我是标签三"));
                    data.add(new rv_collection("2024年四川省遂宁市中考数学试卷", "一、选择题(本大题共10个小题，每小题4分，共40分,在每个小题给出的四个选项..",
                            R.drawable.example_face, "我是标签一", "我是标签二", "我是标签三"));
                    break;
                case "教案类":
                    data = new ArrayList<>();

                    break;
                case "视频类":
                    data = new ArrayList<>();

                    break;
                case"课件类":
                    data = new ArrayList<>();
                    break;
                default:
                    break;
            }
            rvCollectAdapter adapter = new rvCollectAdapter(data);
            rv_Collection.setAdapter(adapter);
            rv_Collection.setLayoutManager(new LinearLayoutManager(getActivity()));
        }
        return view;
    }
}